home *** CD-ROM | disk | FTP | other *** search
- /*
- * locale.c V2.1
- *
- * localization stuff
- *
- * (c) 1990-1993 Stefan Becker
- */
-
- #include "ToolManagerConf.h"
-
- /* locale string array */
- char *AppStrings[]={
- MSG_WINDOW_TOP_GAD_STR,
- MSG_WINDOW_UP_GAD_STR,
- MSG_WINDOW_DOWN_GAD_STR,
- MSG_WINDOW_BOTTOM_GAD_STR,
- MSG_WINDOW_REMOVE_GAD_STR,
- MSG_WINDOW_NAME_GAD_STR,
- MSG_WINDOW_COMMAND_GAD_STR,
- MSG_WINDOW_HOTKEY_GAD_STR,
- MSG_WINDOW_PUBSCREEN_GAD_STR,
- MSG_WINDOW_POSITION_OPEN_LABEL_STR,
- MSG_WINDOW_POSITION_CLOSE_LABEL_STR,
- MSG_WINDOW_LEFTEDGE_GAD_STR,
- MSG_WINDOW_TOPEDGE_GAD_STR,
- MSG_WINDOW_EXEC_GAD_STR,
- MSG_WINDOW_IMAGE_GAD_STR,
- MSG_WINDOW_SOUND_GAD_STR,
- MSG_WINDOW_OK_GAD_STR,
- MSG_WINDOW_CANCEL_GAD_STR,
-
- MSG_MAINWIN_TITLE_STR,
- MSG_MAINWIN_TYPE_GAD_STR,
- MSG_MAINWIN_TYPE_EXEC_CYCLE_LABEL_STR,
- MSG_MAINWIN_TYPE_IMAGE_CYCLE_LABEL_STR,
- MSG_MAINWIN_TYPE_SOUND_CYCLE_LABEL_STR,
- MSG_MAINWIN_TYPE_MENU_CYCLE_LABEL_STR,
- MSG_MAINWIN_TYPE_ICON_CYCLE_LABEL_STR,
- MSG_MAINWIN_TYPE_DOCK_CYCLE_LABEL_STR,
- MSG_MAINWIN_TYPE_ACCESS_CYCLE_LABEL_STR,
- MSG_MAINWIN_LIST_GAD_STR,
- MSG_MAINWIN_SORT_GAD_STR,
- MSG_MAINWIN_NEW_GAD_STR,
- MSG_MAINWIN_EDIT_GAD_STR,
- MSG_MAINWIN_COPY_GAD_STR,
- MSG_MAINWIN_SAVE_GAD_STR,
- MSG_MAINWIN_USE_GAD_STR,
- MSG_MAINWIN_TEST_GAD_STR,
-
- MSG_MAINWIN_PROJECT_MENU_LABEL_STR,
- MSG_MAINWIN_OPEN_MENU_LABEL_STR,
- MSG_MAINWIN_OPEN_MENU_SHORTCUT_STR,
- MSG_MAINWIN_APPEND_MENU_LABEL_STR,
- MSG_MAINWIN_SAVEAS_MENU_LABEL_STR,
- MSG_MAINWIN_SAVEAS_MENU_SHORTCUT_STR,
- MSG_MAINWIN_ABOUT_MENU_LABEL_STR,
- MSG_MAINWIN_QUIT_MENU_LABEL_STR,
- MSG_MAINWIN_QUIT_MENU_SHORTCUT_STR,
- MSG_MAINWIN_EDIT_MENU_LABEL_STR,
- MSG_MAINWIN_LASTSAVED_MENU_LABEL_STR,
- MSG_MAINWIN_LASTSAVED_MENU_SHORTCUT_STR,
- MSG_MAINWIN_RESTORE_MENU_LABEL_STR,
- MSG_MAINWIN_RESTORE_MENU_SHORTCUT_STR,
- MSG_MAINWIN_SETTINGS_MENU_LABEL_STR,
- MSG_MAINWIN_CREATEICONS_MENU_LABEL_STR,
- MSG_MAINWIN_CREATEICONS_MENU_SHORTCUT_STR,
-
- MSG_MAINWIN_WRITE_ERROR_STR,
-
- MSG_EXECWIN_TITLE_STR,
- MSG_EXECWIN_NEWNAME_STR,
- MSG_EXECWIN_EXECTYPE_GAD_STR,
- MSG_EXECWIN_CURRENTDIR_GAD_STR,
- MSG_EXECWIN_OUTPUT_GAD_STR,
- MSG_EXECWIN_PATH_GAD_STR,
- MSG_EXECWIN_STACK_GAD_STR,
- MSG_EXECWIN_PRIORITY_GAD_STR,
- MSG_EXECWIN_DELAY_GAD_STR,
- MSG_EXECWIN_ARGUMENTS_GAD_STR,
- MSG_EXECWIN_TOFRONT_GAD_STR,
-
- MSG_IMAGEWIN_TITLE_STR,
- MSG_IMAGEWIN_NEWNAME_STR,
- MSG_IMAGEWIN_FILE_GAD_STR,
-
- MSG_SOUNDWIN_TITLE_STR,
- MSG_SOUNDWIN_NEWNAME_STR,
- MSG_SOUNDWIN_AREXX_GAD_STR,
-
- MSG_MENUWIN_TITLE_STR,
- MSG_MENUWIN_NEWNAME_STR,
-
- MSG_ICONWIN_TITLE_STR,
- MSG_ICONWIN_NEWNAME_STR,
- MSG_ICONWIN_SHOWNAME_GAD_STR,
-
- MSG_DOCKWIN_TITLE_STR,
- MSG_DOCKWIN_NEWNAME_STR,
- MSG_DOCKWIN_TITLE_GAD_STR,
- MSG_DOCKWIN_COLUMNS_GAD_STR,
- MSG_DOCKWIN_FONT_GAD_STR,
- MSG_DOCKWIN_ACTIVATED_GAD_STR,
- MSG_DOCKWIN_BACKDROP_GAD_STR,
- MSG_DOCKWIN_CENTERED_GAD_STR,
- MSG_DOCKWIN_FRONTMOST_GAD_STR,
- MSG_DOCKWIN_MENU_GAD_STR,
- MSG_DOCKWIN_PATTERN_GAD_STR,
- MSG_DOCKWIN_POPUP_GAD_STR,
- MSG_DOCKWIN_STICKY_GAD_STR,
- MSG_DOCKWIN_TEXT_GAD_STR,
- MSG_DOCKWIN_VERTICAL_GAD_STR,
- MSG_DOCKWIN_EDITTOOLS_GAD_STR,
-
- MSG_DOCKLISTWIN_TITLE_STR,
- MSG_DOCKLISTWIN_TOOLS_GAD_STR,
- MSG_DOCKLISTWIN_NEW_GAD_STR,
-
- MSG_ACCESSWIN_TITLE_STR,
- MSG_ACCESSWIN_NEWNAME_STR,
- MSG_ACCESSWIN_ENTRIES_GAD_STR,
- MSG_ACCESSWIN_ADD_GAD_STR,
-
- MSG_SELECTWIN_TITLE_STR,
- MSG_SELECTWIN_OBJECT_GAD_STR,
- MSG_SELECTWIN_MENU_MX_LABEL_STR,
- MSG_SELECTWIN_ICON_MX_LABEL_STR,
- MSG_SELECTWIN_MENUICON_MX_LABEL_STR,
-
- MSG_MOVEWIN_DRAG_GAD_STR,
-
- MSG_FILEREQ_TITLE_FILE_STR,
- MSG_FILEREQ_TITLE_DRAWER_STR,
- MSG_FILEREQ_OK_GAD_STR,
- MSG_FILEREQ_SAVE_GAD_STR,
- MSG_FILEREQ_CANCEL_GAD_STR,
-
- MSG_FONTREQ_TITLE_STR,
-
- MSG_LISTREQ_TITLE_EXEC_STR,
- MSG_LISTREQ_TITLE_IMAGE_STR,
- MSG_LISTREQ_TITLE_SOUND_STR,
- MSG_LISTREQ_TITLE_DOCK_STR,
- MSG_LISTREQ_TITLE_PUBSCREEN_STR,
-
- MSG_HOSTREQ_TITLE_STR
- };
-
- /* misc. data */
- struct Library *LocaleBase=NULL;
- static struct Catalog *Catalog;
-
- /* Get locale strings */
- void GetLocale(void)
- {
- /* Try to open locale.library */
- if (LocaleBase=OpenLibrary("locale.library",38)) {
-
- DEBUG_PRINTF("Locale: 0x%08lx\n",LocaleBase);
-
- /* Try to get catalog for current language */
- if (Catalog=OpenCatalog(NULL,"toolmanager.catalog",
- OC_BuiltInLanguage, "english",
- OC_Version, 3,
- TAG_DONE)) {
- /* Read in locale language strings */
- char **as=AppStrings;
- ULONG i;
-
- DEBUG_PRINTF("Catalog: 0x%08lx\n",Catalog);
-
- /* Get translation strings */
- for (i=0; i<=MSG_HOSTREQ_TITLE; i++, as++)
- *as=GetCatalogStr(Catalog,i,*as);
- }
- }
- }
-
- void FreeLocale(void)
- {
- if (LocaleBase) {
- if (Catalog) CloseCatalog(Catalog);
- CloseLibrary(LocaleBase);
- }
- }
-